import type router from './router'
const whiteRouters = ['/login', '/404', '/register']
export default function (road: typeof router) {
  road.beforeEach((to, from, next) => {
    if (!whiteRouters.includes(to.path)) {
      if (!localStorage.getItem('token')) {
        return next('/login')
      }
    }
    next()
  })
}
